import { Form, Input, Button, Select, message } from 'antd';
import './Edit2.scss'
import '../../../static/font/iconfont.css'
import Avatar from './Avatar';
import { useEffect } from 'react';
const { Option } = Select;
const layout = {
    labelCol: {
        span: 7,
    },
    wrapperCol: {
        span: 16,
    },
};
const layout1 = {
    labelCol: {
        span: 7,
    },
    wrapperCol: {
        span: 8,
    },
};


const Edit2 = ({ props }) => {

    useEffect(()=>{
        console.log(props);
    })

    // 保存
    // const save = () => {
    //     message.success('保存成功',[0.8]);
    //     setTimeout(() => {
    //         setaddyemian(false)
    //     }, 1500);

    // }
    const [form] = Form.useForm();

    const onGenderChange = (value) => {
        switch (value) {
            case 'male':
                form.setFieldsValue({
                    note: 'Hi, man!',
                });
                return;

            case 'female':
                form.setFieldsValue({
                    note: 'Hi, lady!',
                });
                return;

            case 'other':
                form.setFieldsValue({
                    note: 'Hi there!',
                });
        }
    };

    return (
        <div className="Edit2">
            <div className='cont'>

                <div className='title'>
                    <span>设备基本信息:</span>
                    <span>设备详细信息:</span>
                </div>
                <div className='message'>
                    <Form {...layout} form={form} name="control-hooks" className='leftfrom'>
                        <Form.Item
                            name="name"
                            label="设备名称"
                            initialValue={props.mydata.ddetName}
                            rules={[
                                {
                                    required: true,
                                },
                            ]}
                        >
                            <Input  disabled/>
                        </Form.Item>
                        <Form.Item
                            name="id"
                            label="设备编号"
                            initialValue={props.mydata.ddetNumber}
                            rules={[
                                {
                                    required: true,
                                },
                            ]}
                        >
                            <Input disabled/>
                        </Form.Item>
                        <Form.Item
                            name="model"
                            label="设备型号"
                            // placeholder='ISS20200816'
                            initialValue={props.mydata.ddetType}
                            rules={[
                                {
                                    required: true,
                                },
                            ]}
                        >
                            <Input />
                        </Form.Item>
                        <Form.Item
                            name="time"
                            label="运行时间："
                            initialValue={props.mydata.dinfUpdate}
                            rules={[
                                {
                                    required: true,
                                },
                            ]}
                        >
                            <Input disabled/>
                        </Form.Item>
                        <Form.Item
                            name="type"
                            label="运行状态"
                            rules={[
                                {
                                    required: true,
                                },
                            ]}
                        >
                            <Select
                                placeholder="正常"
                                onChange={onGenderChange}
                                allowClear
                            >
                                <Option value="请选择">请选择</Option>
                                <Option value="正常">正常</Option>
                                <Option value="禁用">禁用</Option>
                            </Select>
                        </Form.Item>
                        <Form.Item
                            name="people"
                            label="跟进人"
                            initialValue='请输入跟进人'
                            rules={[
                                {
                                    required: true,
                                },
                            ]}
                        >
                            <Input disabled/>
                        </Form.Item>

                        <Form.Item
                            name="tel"
                            label="联系方式"
                            rules={[
                                {
                                    required: true,
                                },
                            ]}
                        >
                            <Input disabled/>
                        </Form.Item>

                    </Form>

                    <Form {...layout1} form={form} name="control-hooks" className='right' >
                        <Form.Item
                            className='weizhi'
                            name="location"
                            label="安装位置："
                            rules={[
                                {
                                    required: true,
                                },
                            ]}
                        >
                            <Input disabled />
                        </Form.Item>
                        <span className='iconfont icon-a-19dingwei'></span>

                        <div className='map'>
                        {/* <img src={require('../assets/logo.png')} alt='map'/> */}
                        </div>

                        <Form.Item
                            className='phone1'
                            name="Nowphoto"
                            label="现场照片："
                            rules={[
                                {
                                    required: true,
                                },
                            ]}
                        >
                            <Avatar />
                        </Form.Item>
                        <Form.Item
                            className='phone2'
                            name="photo"
                            label="设备照片："
                            rules={[
                                {
                                    required: true,
                                },
                            ]}
                        >
                            <Avatar />
                        </Form.Item>


                    </Form>
                </div>
                <Button type="primary" size='large' className='btn'>保存</Button>
                <Button type='default' size='large'>取消</Button>
            </div>
        </div>
    );
}
export default Edit2;